﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Resources;
using System.Reflection;

namespace Axe.ComponentModel
{
    public class ResourceBoundCategory : CategoryAttribute
    {
        public ResourceBoundCategory(string resourceName, string resourceKey)
            : base(GetCategory(resourceName, resourceKey))
        {
        }

        static string GetCategory(string resourceName, string resourceKey)
        {
            Assembly ass = Assembly.GetEntryAssembly();
            ResourceManager rm = new ResourceManager(resourceName, ass);
            return rm.GetString(resourceKey);
        }
    }
}
